%% [Gmean, Accuracy] = Performance(Labels, PredictedLabels)
% 
% inputs labels must be column vector with the labels 1 .. n for a n class
% problem 
% 

function [G, A, varargout] = Performance(L, PL)
 
NumOfClasses = max(L); % number of classes, 

G = 1; % inicialization, 

for c = 1:NumOfClasses, 
    G = G * sum(PL==L & L==c)/sum(L==c);
    AccForClass(c) = sum(PL==L & L==c)/sum(L==c);
end

G = G^(1/NumOfClasses);

A = sum(PL==L)/length(L);
varargout{1} = AccForClass;

end